package com.richpay.basejava.base15;

public class CustomerExceptionDemo {
    public static void main(String[] args) {
        int num = 5;
        int num2 = -2;

        if (num2 < 0) {//抛出小于0的异常
            try {
                throw new MyException("除数不能小于0");
            } catch (MyException e) {
                e.printStackTrace();//打印异常发生的轨迹
                String msg = e.getMessage();
                System.out.println("msg=" + msg);
            }
        }
    }
}
